import { _decorator, Color, Component, Label, Node, Sprite } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('LeaderboardItem')
export class LeaderboardItem extends Component {
    @property(Sprite)
    Icon: Sprite = null;

    @property(Label)
    Name: Label = null;

    @property(Label)
    Score: Label = null;

    init(color: Color, name: string, score: string, isLast: boolean) {
        this.Icon.color = color;
        this.Name.color = isLast ? Color.RED : Color.WHITE;
        this.Name.string = name + ": ";
        this.Score.color = isLast ? Color.RED : Color.WHITE;
        this.Score.string = score;
    }
}


